{include file="public/header" /}
<div class="page">
<form method="post" name="remark_form" id="remark_form"  >
    <input type="hidden" value="{$commonids}" name="commonids">
       <br/>
       <br/>
       <span><a href="javascript:void(0);" class="dsui-btn-edit" id='pi_ids' style="float:right; margin: 23px 55px 2px 0;padding: 0px 17px;height: 31px;line-height: 31px;"><i class="iconfont"></i>批量操作</a></span>
       <br/>
       <br/>
       <br/>
    <table class="ds-default-table nobdb">
            <tr>
                <td><input type="checkbox" class="checkall" id="checkallBottom"></td>
                <td><label>商品名及规格值</label></td>
                <td><label>供应商销售价</label></td>
                 <td><label>平台分享价（提成）</label></td>
                 <td><label>平台分享价（加价）</label></td>
                <td><label>库存</label></td>
                <td><label>库存安全值</label></td>
                <td><label>操作</label></td>
            </tr>
            <?php foreach($goods_info as $k=>$v){?>
            <tr>
                <td><input type="checkbox" value="{$v.goods_id}" class="checkitem"></td>
                <td ><?php echo $v['goods_name']; ?></td>
                <td ><?php echo $v['goods_price']; ?></td>
                <td><label><?php echo $v['t_price']; ?></label></td>
                <td><label><?php echo $v['g_price']; ?></label></td>
                <td><label><?php echo $v['goods_storage']; ?></label></td>
                <td><label><?php echo $v['goods_storage_alarm']; ?></label></td>
                <td><a href="javascript:void(0);" onclick="goods_setting_price({$v['goods_id']});" class="dsui-btn-edit"><i class="iconfont"></i>设置价格</a></td>
            </tr>
            <?php }?>

           
        </table>
    <table class="ds-default-table nobdb">
        <tbody>
      <?php if($is_edit== 0 ){ ?>
            <tr>
                <td colspan="2" class="required"><label for="parent_id">审核状态：</label></td>
            </tr> 
            <tr class="noborder">
                <td class="vatop rowform">
                      <div class="onoff">
                        <label for="site_state1" class="cb-enable selected" >通过</label>
                        <label for="site_state0" class="cb-disable">不通过</label>
                        <input id="site_state1" name="status" value="1" type="radio" checked='checked'>
                        <input id="site_state0" name="status" value="0" type="radio"  >
                    </div>
                </td>
            </tr>
            <tr class="noborder" >
                <td colspan="2" class="required" id="installation_fee_ero_one"><label>不通过原因:</label></td>
            </tr>
          <tr class="noborder" >
              <td class="vatop rowform onoff">
                  <textarea id="installation_fee_ero" name="content" ></textarea>
              </td>
          </tr>
          
          
        
                  </tbody>
        <tfoot>
            <tr class="tfoot">
                <td colspan="2">
                    <input type='submit' class="btn" style="line-height: 30px;" value="{$Think.lang.ds_submit}"/>
                </td>
            </tr>
             <?php } ?>
        </tfoot>
    </table>
</form></div>
<script>

    goods_info = {:$json_goods_info};
    $(document).ready(function () {
        $("form").submit(function (e) {
        var verify_state =  $('input[name="status"]:checked').val();

        if(verify_state != 1){
            //alert(verify_state);return false;
           var content =  $('#installation_fee_ero').val();
            // alert(verify_reason);return false;
            if(content.replace(/\s+/g,"") == ''){
                layer.msg('请填写违规理由');return false;
            }
        }else{
            //审核通过的情况下.判断是否设置所有
            for(let v of goods_info){
                if(v.t_price=='未设置'){
                    layer.msg('请补全信息后在再提交');return false;
                }
            }
        }

        });

    });
    $(function() {
        $("#installation_fee_ero_one").hide();
        $("#installation_fee_ero").hide();

        $('input[name="status"]').click(function() {
            if ($(this).val() == 1) {
                $("#installation_fee_ero_one").hide();
                $("#installation_fee_ero").hide();
            } else {
                $("#installation_fee_ero_one").show();
                $("#installation_fee_ero").show();
            }
        });
    });
    //商品设置平台价格
    function goods_setting_price(ids_str) {
      _uri = ADMINSITEURL+"/Product/set_price?commonid=" + ids_str;
        dsLayerOpen(_uri,'{$Think.lang.ds_setting_price}','810px','610px');
    }

    // 批量处理
    $('a[id="pi_ids"]').click(function(){
        ids_str = getItems();
        /*alert(ids_str);return false;*/
        if (ids_str) {
            goods_setting_price(ids_str);
        }
    });

    // 获得选中ID
    function getItems() {
        /* 获取选中的项 */
        var items = '';
        $('.checkitem:checked').each(function () {
            items += this.value + ',';
        });
        if (items != '') {
            items = items.substr(0, (items.length - 1));
        }else{
            layer.alert('{$Think.lang.please_select_input}', {icon: 2})  
        }
        return items;
    }




    
</script>